/*
 * @lc app=leetcode.cn id=171 lang=typescript
 *
 */

// @lc code=start
function titleToNumber(columnTitle: string): number {
    let position = 0;
    let sum = 0;
    for (let index = columnTitle.length - 1; index >= 0; index--) {
        const num = columnTitle.charCodeAt(index) - 64;
        sum += num * 26 ** position;
        position++;
    }
    return sum;
}
// @lc code=end
